package com.syni.mdd.yhd.common.all.service;

import com.syni.mdd.yhd.common.all.dao.jpa.BmsDxGroupBuyUseDao;
import com.syni.mdd.yhd.common.all.dto.requestDto.groupBuy.GroupBuyUseReDto;
import com.syni.mdd.yhd.common.all.entity.BmsDxGroupBuyUse;
import com.syni.mdd.yhd.common.all.entity.BmsDxOrder;
import com.syni.mdd.yhd.common.all.entity.record.ReOrderLog;
import org.apache.commons.collections.CollectionUtils;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @className BmsDxGroupBuyUseService
 * @description TOO
 * @Author cfx
 * @DATE 2019/7/30 10:58
 * @VERSION 1.0
 **/
public interface BmsDxGroupBuyUseService{

    //扫码核销
    int USE_WAY_SCAN = 1;
    //输入码核销
    int USE_WAY_IN_CODE = 2;

    BmsDxGroupBuyUseDao getBaseDao();

    List<BmsDxGroupBuyUse> getGroupByCode(Integer id,Integer status);

    List<BmsDxGroupBuyUse> getGroupByCodeOrderNoUse(Integer orderId);

    Map<Integer,List<BmsDxGroupBuyUse>> getGroupByCode(Set ids);

    Double countGroupOrderTotal(Integer businessId,Set useStatus);

    Double countGroupOrderTotal(Integer businessId,Integer useStatus);

    Integer countGroupBuyUseCountByTime(Integer businessId,Set status,String startTime,String endTime);

    Integer countGroupBuyUseCountByTime(Set businessId,Set status,String startTime,String endTime);

    Double countGroupBuyUseSumByTime(Integer businessId,Set status,String startTime,String endTime);

    Double countGroupBuyUseSumByTime(Set businessIds,Set status,String startTime,String endTime);

    List<Map<String,Object>> getGroupBuyNumMap(Set orderIds);

    Map<String, Object> userGetGroupBuyUse(GroupBuyUseReDto groupBuyUseReDto);

    Integer countUserUseGroupBuyNum(Integer userId);

    Integer getUserBuyNum(Integer userId, Integer id);

    List<Map<String,Object>> countUserReceGroupBuy(Set userReceIds);

    ReOrderLog generateGroupUse(ReOrderLog orderLog, BmsDxOrder bmsDxOrder, Date nowTime);

    void generateGroupUse_V2(BmsDxOrder bmsDxOrder, Date nowTime);

    List<BmsDxGroupBuyUse> getAllVerRecord(Integer orderId);

    void countBackCard(BmsDxGroupBuyUse bmsDxGroupBuyUse);

    Integer countRefundIngNum(Integer orderId);

    Integer countRefundNum(Integer orderId);

    Map<Integer,Integer> countGroupBuyUseCountByBusinessIds(Set businessIds,String startTime,String endTime);

    Map<String, Object> countMoneyData(Integer orderId, Date verTime);

    BmsDxGroupBuyUse getGroupByCode(String code);

    void addRefundId(List<BmsDxGroupBuyUse> buyUses, String refundId);

    boolean checkCouponBelongBusiness(Integer businessUserId,Integer orderId);

    void postHandleQrCodeText(List<BmsDxGroupBuyUse> bmsDxGroupBuyUses);
}
